// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-6-28

#ifndef __SCROLLBAR_H_COMMON_UI__
#define __SCROLLBAR_H_COMMON_UI__

#pragma once

#include "wnd.h"
#include "button.h"

//##ModelId=44C4B6020280
class CJoyScrollBar :
    public CJoyWnd
{
	DECLARE_DYNAMIC(CJoyScrollBar)
public:
	//##ModelId=44C4B602031E
    enum SCROLLBAR_MESSAGE
    {
		//##ModelId=44C4B6020320
        SBM_SET_POS,
		//##ModelId=44C4B602032C
        SBM_LINE_NEAR,
		//##ModelId=44C4B602032D
        SBM_LINE_FAR,
		//##ModelId=44C4B602032E
        SBM_PAGE_NEAR,
		//##ModelId=44C4B602033C
        SBM_PAGE_FAR,
    };
	//##ModelId=44C4B602033D
    typedef void (CJoyWnd::*PScrollEvent)(CJoyScrollBar*, SCROLLBAR_MESSAGE, float&);
protected:
    friend class CJoyScrollButton;

	//##ModelId=44C4B6020292
    CJoyButton* m_near;
	//##ModelId=44C4B6020297
    CJoyButton* m_far;
	//##ModelId=44C4B60202A0
    CJoyButton* m_scroll;

	//##ModelId=44C4B60202A4
    bool    m_vert;
	//##ModelId=44C4B60202A5
    float   m_scrollPos;

	//##ModelId=44C4B60202B0
    PScrollEvent    m_scrollEvent;
	//##ModelId=44C4B60202B5
    CJoyWnd*        m_eventWnd;

	//##ModelId=44C4B60202BF
    void ValidateScroll();
	//##ModelId=44C4B60202C0
    void MoveScroll(const CPoint& p);

	//##ModelId=44C4B60202C2
    virtual void CM_SetScrollPos(float scrollPos);
	//##ModelId=44C4B60202D0
    virtual void CM_SideClick(CJoyButton* btn);
	//##ModelId=44C4B60202D3
    virtual void CM_PageClick(const CPoint& pt);

	//##ModelId=44C4B60202E0
    virtual void CM_LoadSkin(CJoyXmlElement* pSkinElem);
	//##ModelId=44C4B60202E3
    virtual void CM_Mouse(MouseMessage msg, const CPoint& pt);

public:
	//##ModelId=44C4B60202F1
    CJoyScrollBar(void);
	//##ModelId=44C4B60202F3
    virtual ~CJoyScrollBar(void);

	//##ModelId=44C4B60202FE
    void SetScrollEvent(CJoyWnd* eventWnd, PScrollEvent scrollEvent);
	//##ModelId=44C4B6020301
    void UpdateScrollPos(float scrollPos);
public:
    DECLARE_MESSAGE_MAP()
	//##ModelId=44C4B602030E
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	//##ModelId=44C4B6020311
    afx_msg void OnSize(UINT nType, int cx, int cy);
};


#endif  // __SCROLLBAR_H_COMMON_UI__
